package com.itheima.sh;

import com.itheima.sh.config.MyConfig;
import com.itheima.sh.pojo.User;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Import;

@SpringBootApplication
@Import(MyConfig.class)
public class DataApplication {
    public static void main(String[] args) {
        ConfigurableApplicationContext applicationContext = SpringApplication.run(DataApplication.class, args);
        User user1 = applicationContext.getBean("getUser", User.class);
        User user2 = applicationContext.getBean("getUser", User.class);
        System.out.println(user1==user2);
        MyConfig myConfig1 = applicationContext.getBean("myConfig", MyConfig.class);
        MyConfig myConfig2 = applicationContext.getBean("myConfig", MyConfig.class);
        User user3 = myConfig1.getUser();
        System.out.println(myConfig1==myConfig2);
        System.out.println(user1==user3);
    }
}
